<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    鱼香肉丝<input type="checkbox" name="food" id="">
    <div></div>
    <div></div>
    <div></div>


    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.3/jquery.js"></script>
    <script>

        // console.log($(':checkbox').attr('name'));
        // $(':checkbox').attr('name','cook')
        $(':checkbox').attr({ 'name': 'look', 'id': 'test' })

        // $('div').html('<p>lorem</p>')
        $("div").html(function (index) {
            return `<p data-id=${index}>lorem${index}</p>`
        });
    </script>

</body>

</html>